
#ifndef _PANEL_COMM_H
#define _PANEL_COMM_H

#include "../GenericTypeDefs.h"
#include <stdbool.h>

typedef struct _PanelCommRecPack {
    uint8_t PackHead;
    uint8_t PackIndex;
    uint16_t PackLength;
    uint8_t StationNum;
    uint8_t Cmd;
    uint8_t Data[64];
    uint8_t DataByteLength;
    uint16_t Crc;
    uint8_t PackTail;
} PanelCommRecPack;

typedef struct _PanelCommRplyPack {
    uint8_t PackHead;
    uint8_t PackIndex;
    uint16_t PackLength;
    uint8_t StationNum;
    uint8_t Cmd;
    uint8_t Data[256];
    uint8_t DataByteLength;
    uint16_t Crc;
    uint8_t PackTail;
} PanelCommRplyPack;

extern PanelCommRecPack PanelCommRecPacket;
extern PanelCommRecPack PanelCommRecPacket_CK;
extern PanelCommRplyPack PanelCommRplyPacket;

void PanelComm_Init(void);
void PanelComm_BuildRecPack(void);
void PanelComm_BuildRecPack_ck(void);
bool PanelComm_ChkAndClearPackValidFlag(void);
void PanelComm_FillTxBytesWithRplyPack(void);
void PutByteInTxBuf(uint8_t byte, uint16_t offset);
void RotateAxis_FillTxBytesWithRplyPack(void);

#endif